package d0330;



import java.util.*;


public class Student{
    private int id;
    private String name;
    private int course;

    public Student(int id, String name, int course) {
        this.id = id;
        this.name = name;
        this.course = course;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCourse() {
        return course;
    }

    public void setCourse(int course) {
        this.course = course;
    }

    @Override
    public String toString() {
        return "学号:"+getId()+" "+"姓名:"+getName()+" "+"成绩:"+getCourse();
    }

    public static void main(String[] args) {
        Random r=new Random();
        List<Student>mylist=new ArrayList<>();
        for(int i=1;i<69;i++){
            mylist.add(new Student(180200+i,"同学"+i,r.nextInt(50)+51));//添加对象
        }
        Collections.sort(mylist,new TestComeparetor());//排序
        Iterator<Student> iterator=mylist.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }

}